package consumer6;

import java.util.concurrent.BlockingQueue;

public class Consumer implements Runnable {

	private final BlockingQueue<Integer> q;
	String name;

	public Consumer(BlockingQueue<Integer> q, String name) {
		this.q = q;
		this.name = name;
	}

	@Override
	public void run() {
		try {
			while (true) {
				consume(q.take());
			}

		} catch (Exception e) {
		}
	}

	private void consume(Integer take) {
		System.out.println(this.name + ">>" + take);
	}

}
